package fun.sanguo.mapper.interact;

import com.alibaba.fastjson.JSONObject;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;
import fun.sanguo.model.entity.interact.InteractPersonageDislikeEntity;
import fun.sanguo.utils.sqlBuilder.SqlBuilderInteractPersonageDislike;

import java.util.List;

/**
 * 人物厌恶记录表 Mapper接口
 *
 * @author ZYP
 * @date 2023-10-13
 */
@Mapper
public interface InteractPersonageDislikeMapper {

    /**
     * 新增
     *
     * @param interactPersonageDislikeEntity
     * @return
     */
    @InsertProvider(type = SqlBuilderInteractPersonageDislike.class, method = "insert")
    Integer insert(InteractPersonageDislikeEntity interactPersonageDislikeEntity);

    /**
     * 删除
     *
     * @param interactPersonageDislikeEntity
     * @return
     */
    @UpdateProvider(type = SqlBuilderInteractPersonageDislike.class, method = "delete")
    Integer delete(InteractPersonageDislikeEntity interactPersonageDislikeEntity);

    /**
     * 根据ID查询记录
     *
     * @param id
     * @return
     */
    @SelectProvider(type = SqlBuilderInteractPersonageDislike.class, method = "getById")
    InteractPersonageDislikeEntity getById(String id);

    /**
     * 根据用户与人物查询记录
     *
     * @param userId
     * @param personageId
     * @return
     */
    @SelectProvider(type = SqlBuilderInteractPersonageDislike.class, method = "getByUserPersonage")
    InteractPersonageDislikeEntity getByUserPersonage(String userId, String personageId);

    /**
     * 根据用户查询记录
     *
     * @param userId
     * @return
     */
    @SelectProvider(type = SqlBuilderInteractPersonageDislike.class, method = "getByUser")
    List<InteractPersonageDislikeEntity> getByUser(String userId);

    /**
     * 查询指定人物的厌恶数量
     *
     * @param personageId
     * @return
     */
    @SelectProvider(type = SqlBuilderInteractPersonageDislike.class, method = "getSummaryByPersonage")
    int getSummaryByPersonage(String personageId);

    /**
     * 查询所有人物的厌恶数量
     *
     * @return
     */
    @SelectProvider(type = SqlBuilderInteractPersonageDislike.class, method = "getSummary")
    List<JSONObject> getSummary();
}
